public class Test {
    public ListNode reverseList(ListNode head) {
        if(head==null){
            return null;
        }
        ListNode pre=head;
        ListNode cur=head.next;
        ListNode curNext=cur.next;
        while(cur!=null){
            cur.next=pre;
            pre=cur;
            cur=curNext;
            curNext=curNext.next;
        }
        return cur;

    }
    public static void main(String[] args) {

    }
}
